C (220/301)

From:Martyn Capewell
Date:07 Aug 99 at 12:50:19
Subject:Re: Menus and Hooks

From: Martyn Capewell <martyn@jubileeweb.freeserve.co.uk>

Hello David

On 06-Aug-99, you wrote:

> From: "David McMinn" <D.Mcminn@eee.rgu.ac.uk>
>
>
> You just specify the shortcut key, the <A> graphic will be added by
> Intuition automatically.

I've tried that and it doesn't seem to happen.

After following up another reply, I've found that it works if I remove the
NM_COMMANDSTRING flag, from the flags field of the NewMenu structure. So
what is NM_COMMANDSTRING meant to do?

> It looks like you are not pointing the h_Entry field at a proper function,

<....>

> The C function should be called directly as the hook function.

OK. Thanks.

I now have this code (modified example in the guigfx autodocs):

ULONG __saveds abortdrawfunc(__reg("a0") struct Hook *hook*)
{
return(TRUE);
}

But I still can't initialise the h_Entry field of the Hook structure. If I
do this:

hook->h_Entry = (HOOKFUNC)abortdrawfunc;

VBCC complains "unknown identifier <abortdrawfunc>". And if I put brackets
after it, it'll just cast the result of a call to abortdrawfunc(). I then
tried:

hook->h_Entry = (HOOKFUNC)(abortdrawfunc)();

Which calls abortdrawfunc() and casts the result. Not really what I want ;).

Does anyone know how to obtain a function pointer in VBCC?

Regards



- Martyn Capewell
{ Compsci, University of Cambridge }
{ http://members.xoom.com/legerdemain0 }